<?php

class TimKiemController extends Controller
{
	public function actionIndex()
	{
		if (isset($_POST['q'])) {
			$q = $_POST['q'];
			$doitac = Doitac::model()->findAll("ten like '%$q%' or ma_so like '%$q%' or dien_thoai like '%$q%' or so_hop_dong like '%$q%'");
			$khachhang = Khachhang::model()->findAll("ten like '%$q%' or ma_so like '%$q%' or email like '%$q%' or cmnd like '%$q%' or dien_thoai like '%$q%'");
			$data = DoitacKhachhang::model()->search("so_phieu_thanh_toan like '%$q%'");
			$this->render('index',array('doitac'=>$doitac,'q'=>$q,'khachhang'=>$khachhang,'data'=>$data));
		}
	}
}